#include <iostream>
using std::cout;
using std::endl;


class Circle{
public:
    //构造
    Circle()
    :_r(0)
    {}
    Circle(double r)
    :_r(r)
    {}
    
    double getArea(){
        return PI * _r * _r;
    }
    double getPerimeter(){
        return 2 * PI * _r;
    }
    void show(){
        cout << "r = " << _r <<endl;
        cout << "area = " << getArea() << endl;
        cout << "perimeter = "<< getPerimeter() << endl; 
    }

private:
    double _r;
    const double PI = 3.14;
};


class Cylinder:Circle{
public:
    Cylinder(double r, double h)
    :Circle(r)
    ,_h(h)
    {}
    double getVolume(){
        return getArea() * _h;
    }
    void showVolume(){
        show();
        cout <<"volume = " << getVolume() << endl;
    }
private:
    double _h;
};

void test(){
    Cylinder c(1,1);
    c.showVolume();
}

int main()
{
    test ();
    return 0;
}

